package com.coincalf.admin.service.impl;

import com.baomidou.mybatisplus.mapper.SqlHelper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.coincalf.admin.dto.TradeTopVolumeDTO;
import com.coincalf.admin.dto.TurnoverOrderCountDTO;
import com.coincalf.admin.entity.TurnoverOrder;
import com.coincalf.admin.mapper.TurnoverOrderMapper;
import com.coincalf.admin.service.TurnoverOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 成交订单 服务实现类
 * </p>
 *
 * @author qiang
 * @since 2018-05-13
 */
@Service
public class TurnoverOrderServiceImpl extends ServiceImpl<TurnoverOrderMapper, TurnoverOrder> implements TurnoverOrderService {


    @Autowired
    private TurnoverOrderMapper turnoverOrderMapper;

    @Override
    public Page<TurnoverOrder> selectListPage(Page<TurnoverOrder> page, Wrapper<TurnoverOrder> wrapper) {
        wrapper = (Wrapper<TurnoverOrder>) SqlHelper.fillWrapper(page, wrapper);
        page.setRecords(this.turnoverOrderMapper.selectListPage(page, wrapper));
        return page;
    }

    @Override
    public Page<TradeTopVolumeDTO> selectTradeTopVolumePage(Page<TradeTopVolumeDTO> page, Wrapper<TradeTopVolumeDTO> wrapper) {
        wrapper = (Wrapper<TradeTopVolumeDTO>) SqlHelper.fillWrapper(page, wrapper);
        page.setRecords(this.turnoverOrderMapper.selectTradeTopVolumePage(page, wrapper));
        return page;
    }

    @Override
    public Page<TurnoverOrderCountDTO> selectCountMain(Page<TurnoverOrderCountDTO> page, Map<String, Object> paramMap) {
            return page.setRecords(baseMapper.selectCountMain(page, paramMap));
    }


    @Override
    public List<TurnoverOrderCountDTO> selectSellUserCount(String[]coins ) {
        return baseMapper.selectSellUserCount(coins);
    }

    @Override
    public List<TurnoverOrderCountDTO> selectBuyUserCount(String[]coins ) {
        return baseMapper.selectBuyUserCount(coins);
    }

}
